﻿@model IList<FB.Providers.EmployeeInfo.Department>
@helper NodeHelper(FB.Providers.EmployeeInfo.Department post, IList<FB.Providers.EmployeeInfo.Department> postList, string seedpading)
{ 
    IList<FB.Providers.EmployeeInfo.Department> list = postList.Where(t => t.ParentDEPTCode == post.DEPTCode).ToList(); 
    if (list.Count != 0)
    { 
        foreach (FB.Providers.EmployeeInfo.Department postItem in list)
        {
    <option value="@postItem.DEPTCode" >@(seedpading + postItem.Name)</option>  
    @NodeHelper(postItem, Model, seedpading + "--")   
        }
    } 
}
<select id="deparmentList" style="width:120px;" name="DEPTCode">
    @{
        if (Model != null)
        {
            IList<FB.Providers.EmployeeInfo.Department> rootNodeList = Model.Where(t => t.ParentDEPTCode == null || t.ParentDEPTCode == "").ToList();
            if (rootNodeList != null && rootNodeList.Count > 0)
            {
                foreach (var item in rootNodeList)
                {
           
        <option value="@item.DEPTCode"    >@item.Name</option>
        @NodeHelper(item, Model, "--")   
                }
            }
        }
    }
</select>